package com.example.restful01.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.example.restful01.model.Book;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface BookMapper extends BaseMapper<Book> {
    @Select("SELECT * FROM book WHERE book_name LIKE CONCAT('%', #{name}, '%') OR author LIKE CONCAT('%', #{name}, '%')")
    List<Book> searchBook(String name);
    @Update("update book set book_name = #{bookName} where id = #{id}")
    int changeBookInfo(Book book);
}
